import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from '@/router'

import Cookies from 'js-cookie'
import Element from 'element-ui'
import plugins from './plugins'
import '@/assets/styles/element-variables.scss'
// markdown
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'

import '@/assets/styles/index.scss'
import '@/assets/styles/yuezhi.scss'

import '@/assets/icons'
import '@/permission'

import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from '@/utils/yuezhi'

Vue.prototype.msgSuccess = function(msg) {
    this.$message({ showClose: true, message: msg, type: 'success' })
}

Vue.prototype.msgError = function(msg) {
    this.$message({ showClose: true, message: msg, type: 'error' })
}

// 富文本组件
import Editor from "@/components/Editor"
// 字典标签组件
import DictTag from '@/components/DictTag'
// 分页组件
import Pagination from "@/components/Pagination";
// 文件上传组件
import FileUpload from "@/components/FileUpload"
// 图片上传组件
import ImageUpload from "@/components/ImageUpload"
// 图片预览组件
import ImagePreview from "@/components/ImagePreview"
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"



// 全局方法挂载
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.handleTree = handleTree

// 全局组件挂载
Vue.component('Editor', Editor)
Vue.component('DictTag', DictTag)
Vue.component('Pagination', Pagination)
Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.component('ImagePreview', ImagePreview)
Vue.component('RightToolbar', RightToolbar)

Vue.use(mavonEditor)
Vue.use(plugins)
Vue.use(Element, {
    size: Cookies.get('size') || 'medium' // set element-ui default size
})

Vue.config.productionTip = false

new Vue({
  router, store,
  render: h => h(App),
}).$mount('#app')
